package lxy;

public class Thread03 {
    public static void main(String[] args) {
        //线程第三种创建方式
        RunnableTest run2 = new RunnableTest();
        RunnableTest run1 = new RunnableTest();
        Thread tone = new Thread(run1);
        Thread ttwo = new Thread(run2);
        tone.start();
        ttwo.start();
    }
}

class RunnableTest implements Runnable {

    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            try {
                Thread.sleep(300);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("线程在运作");
        }
    }
}